widget: Fix gtk_widget_pick() on 3d-transformed widgets
authorBenjamin Otte <otte@redhat.com>
Sun, 3 Mar 2019 18:40:32 +0000 (19:40 +0100)
committerBenjamin Otte <otte@redhat.com>
Sun, 3 Mar 2019 18:50:59 +0000 (19:50 +0100)
commitbed4c68041fb77a683c29ec5a5e6ddddb441058c
treeaafe36d81443359dee7196e8abb880ffeb2416b4
parent8ceff2149768a5af1e35f54f39b338d9d8ecea21
widget: Fix gtk_widget_pick() on 3d-transformed widgets

Picking is done by drawing a line along the parent's z axis and picking
at the intersection with the child's z=0 plane.

However, the previous code was casting a ray along the child's z axis.

This patch actually transforms the line to pick into the target's
coordinate system and then computes the corrrect intersection with the
z=0 plane.

Using graphene_point3d_interpolate() to compute the final intersection
point is a bit of abuse of that function, but I found no better way in
Graphene to achieve the same thing.
gtk/gtkwidget.c